import PAGE from '../../utils/middleware/page'
const app = getApp()

Page(PAGE({
    data: {},
    onLoad() { },
    handleScanCode() {
        wx.scanCode({
            scanType: ['qrCode'],
            success: (res) => {
                //判断是否为充电二维码
                console.log(res.result)
                if (res.result.indexOf('qrcodenum') > -1) {
                    wx.$Fun.toPage({
                        page: 'chargeScan',
                        params: {
                            q: encodeURIComponent(res.result)
                        }
                    })
                }
                else if (res.result.indexOf('parkId') > -1) {
                    wx.$Fun.toPage({
                        page: 'parkingScan',
                        params: {
                            q: encodeURIComponent(res.result)
                        }
                    })
                }
            },
            fail: (res) => { }
        })
    },
}))